home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / vg-2.03 / jpeg / ycc_to_rgb.s < prev   
Encoding:
Text File  |  1995-05-03  |  1.9 KB  |  96 lines

  1. /
  2. / Copyright (C) 1993 Michael Davidson.
  3. / All rights reserved.
  4. /
  5. / Permission to use, copy, modify, and distribute this software
  6. / and its documentation for any purpose and without fee is hereby
  7. / granted, provided that the above copyright notice appear in all
  8. / copies and that both that copyright notice and this permission
  9. / notice appear in supporting documentation.
  10. /
  11. / This software is provided "as is" without express or implied warranty.
  12. /
  13.     .text
  14. /
  15. / ycc_to_rgb(
  16. /    unsigned char    *y_ptr,
  17. /    unsigned char    *cb_ptr,
  18. /    unsigned char    *cr_ptr,
  19. /    int        count
  20. /    )
  21. /
  22.     .globl    ycc_to_rgb
  23.  
  24. Y_PTR    =    8
  25. CB_PTR    =    12
  26. CR_PTR    =    16
  27. RGB_PTR    =    20
  28. COUNT    =    24
  29.  
  30. ycc_to_rgb:
  31.     pushl  %ebp
  32.     movl   %esp,%ebp
  33.     pushl  %esi
  34.     pushl  %edi
  35.     pushl  %ebx
  36.  
  37.     movl   Y_PTR(%ebp),  %esi
  38.     movl   CB_PTR(%ebp), %edi
  39.     movl   CR_PTR(%ebp), %ebx
  40.     movl   COUNT(%ebp),  %ecx
  41.     movl   RGB_PTR(%ebp),%ebp
  42.     pushl  %ecx
  43.     jmp    L2
  44.     nop
  45.  
  46.     .align    4
  47. L1:
  48.     xorl   %ecx, %ecx
  49.     xorl   %eax, %eax
  50.     movb   (%esi), %cl            / ecx = Y
  51.     movb   (%ebx), %al            / eax = CR
  52.     leal   range_tab+0x100(%ecx), %ecx    / ecx = &range_limit[y]
  53.     movl   %eax, %edx            / save CR
  54. /
  55. / rgb[0] = range_limit[y + Cr_r_tab[cr]];    /* red */
  56. /
  57.     movl   Cr_r_tab(,%eax,4), %eax
  58.     movb   (%ecx,%eax,1), %al
  59.     movb   %al, 0(%ebp)
  60. /
  61. / rgb[2] = range_limit[y + Cb_b_tab[cb]];    /* blue */
  62. /
  63.     xorl   %eax, %eax
  64.     movb   (%edi), %al            / eax = CB
  65.     movb   %al, %dh                / save CB
  66.     movl   Cb_b_tab(,%eax,4), %eax
  67.     movb   (%ecx,%eax,1), %al
  68.     movb   %al, 0x2(%ebp)
  69. /
  70. / rgb[1] = range_limit[y + ((Cb_g_tab[cb]+Cr_g_tab[cr]) >> SCALEBITS)];
  71. /
  72.     xorl   %eax, %eax
  73.     movb   %dh, %al                / eax = CB
  74.     xorb   %dh, %dh                / edx = CR
  75.     movl   Cb_g_tab(,%eax,4), %eax
  76.     addl   Cr_g_tab(,%edx,4), %eax
  77.     sarl   $16, %eax
  78.     movb   (%ecx,%eax,1), %al
  79.     movb   %al, 1(%ebp)
  80.  
  81.     incl   %esi
  82.     incl   %edi
  83.     incl   %ebx
  84.     leal   3(%ebp),%ebp
  85. L2:
  86.     decl   (%esp)
  87.     jge    L1
  88.  
  89.     popl   %ecx                / clean the stack
  90.  
  91.     popl   %ebx
  92.     popl   %edi
  93.     popl   %esi
  94.     popl   %ebp
  95.     ret    
  96.